/*
 *  @(#)Person.java    0.3 16/04/2009
 */
package org.miao.example.domain;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;

/**
 * 用户
 * @author Miao
 * @version 0.3
 * @since 0.3
 */
@Entity
public class Person implements Serializable {

    /**
     * 串行化UID
     */
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    /**
     * 姓名
     */
    private String name;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 描述
     */
    private String description;
    /**
     * 乐观锁
     */
    @Version
    private Long version;

    /**
     * 获得主键
     * @return 主键
     * @since 0.3
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置主键
     * @param id 主键
     * @since 0.3
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 获得姓名
     * @return 姓名
     * @since 0.3
     */
    public String getName() {
        return name;
    }

    /**
     * 设置姓名
     * @param name 姓名
     * @since 0.3
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获得年龄
     * @return 年龄
     * @since 0.3
     */
    public Integer getAge() {
        return age;
    }

    /**
     * 设置年龄
     * @param age 年龄
     * @since 0.3
     */
    public void setAge(Integer age) {
        this.age = age;
    }

    /**
     * 获得描述
     * @return 描述
     * @since 0.3
     */
    public String getDescription() {
        return description;
    }

    /**
     * 设置描述
     * @param description 描述
     * @since 0.3
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * 获得乐观锁
     * @return 乐观锁
     * @since 0.3
     */
    public Long getVersion() {
        return version;
    }

    /**
     * 设置乐观锁
     * @param version 乐观锁
     * @since 0.3
     */
    public void setVersion(Long version) {
        this.version = version;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Person)) {
            return false;
        }
        Person other = (Person) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.miao.example.domain.Person[id=" + id + "]";
    }
}
